<template>
  <view>
    <!-- 动态加载组件 -->
    <component :is="currentComponent" />
  </view>
</template>

<script>
import ComponentA from '@/components/ComponentA.vue';
import ComponentB from '@/components/ComponentB.vue';

export default {
  data() {
    return {
      type: 'A', // 控制加载哪个组件
    };
  },
  computed: {
    currentComponent() {
      return this.type === 'A' ? ComponentA : ComponentB;
    },
  },
};
</script>